﻿Vue.component('section-counter',{
  template:"#section-counter",
  data:function () {
	 return{
         content:'',
         edit:[],
         content2:'',
         edit2:[],
         id:0,
         num:0
	 }
  },
  methods:{
      add:function(content) {
          if (content!=''&&content!=null){
              // content:this.content相当于content = this.content
              var number = { content:this.content};
              this.edit.push(number);
              this.content = null;
              this.id = parseInt(this.id+1);
          }
      },
      del(key) {
          var number = this.edit[key];
          this.edit2.push(number);
          this.edit.splice(key, 1);
          this.id=parseInt(this.id-1);
          this.num=parseInt(this.num+1);
      },
      dele(key) {
          var number = this.edit2[key];
          this.edit.push(number);
          this.edit2.splice(key, 1);
          this.id=parseInt(this.id+1);
          this.num=parseInt(this.num-1);
      },
      delete1(key) {
          this.edit.splice(key, 1);
          this.id=parseInt(this.id-1);
      },
      delete2(key) {
          this.edit2.splice(key, 1);
          this.num=parseInt(this.num-1);
      },
      clear(){
          this.edit = [];
          this.edit2= [];
          this.id=parseInt(0);
          this.num=parseInt(0);
      }
  }
});
var vm = new Vue({
    el:'#root',
    data:{},
    methods:{}
});


